﻿namespace WebPacker.VersionGenerators
{
	using System;
	using WebPacker.Packs;

	public sealed class HashCodeVersionGenerator : IVersionGenerator
	{
		public HashCodeVersionGenerator()
		{
			Name = "hashCode";
		}

		public string Name { get; set; }

		public string GetNextVersion(Pack pack)
		{
			if (pack == null)
			{
				throw new ArgumentNullException("pack");
			}

			return pack.GetSourceContent().GetHashCode().ToString("x");
		}
	}
}